﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Administrator_ChucNangSanPham : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.GridView1.Rows.Count == 0)
        {
            this.FormView1.DefaultMode = FormViewMode.Insert;
        }
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
       
    }
    protected void GridView1_RowCommand1(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Xoa")
            {
                ChucNangDA cda = new ChucNangDA();
                //Response.Write();
                cda.xoaByID(Convert.ToInt32(e.CommandArgument));
                this.Response.Redirect(Request.RawUrl);
                //return;
            }
        }
        catch (Exception)
        {

            throw;
        }
    }
    protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
        Response.Redirect(Request.RawUrl);
    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        this.FormView1.DefaultMode = FormViewMode.Insert;
    }
    protected void InsertCancelButton_Click(object sender, EventArgs e)
    {
        this.FormView1.DefaultMode = FormViewMode.ReadOnly;
    }
}